home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c,comp.lang.c++
- Path: news.inap.net!news1!ind-008-237-87
- From: dlmiller@iquest.net (Doug Miller)
- Subject: Re: Q:Hex to Decimal?
- X-Nntp-Posting-Host: ind-008-237-87.iquest.net
- Message-ID: <Dpr4w6.5M0@iquest.net>
- Sender: news@iquest.net (News Admin)
- Organization: IQuest Network Services
- X-Newsreader: News Xpress Version 1.0 Beta #2.1
- References: <316D2289.4759@tricon.net>
- Date: Fri, 12 Apr 1996 13:48:05 GMT
-
- Thomas A Cooper <tacooper@tricon.net> wrote:
- >I saw in a magazine a simple function to convert a HEX string to an
- >integer:
- >
- >long int FAR PASCAL hex2int(char far *s)
- >{
- > return strtol(s,NULL,16);
- >}
- >
- > I'm struggling with the reverse situation, a function to convert an
- >integer into a HEX string. Anybody got any ideas?? Thanks in advance for
- >your help.
- > Tom Cooper
- > tacooper@tricon.net
-
- use sprintf(), e.g.
-
- sprintf (hexstring, "%x", integer);
-